#pragma once

#include "xtxtloader.h"
#include "AngelHeapAlloc.h"

enum OBJECT_TYPES
{
	BASEOBJECT,
	BASEOBJECT2D,
	OBJECTNPC,
	TOTAL_OBJECTS
};

class BaseObjectBase: public AngelHeapAlloc
{
protected:
	bool m_bActive;
public:
	OBJECT_TYPES m_eType;

	BaseObjectBase() {m_bActive = true;}
	virtual void Update(float _dt) = 0;
	virtual void Render() = 0;
	virtual ~BaseObjectBase() { }

};

class BaseObject : public BaseObjectBase
{
protected:
	stXFile* m_xFile; //loaded animation file

	D3DXVECTOR3 m_Velocity;
	D3DXVECTOR3 m_Position;

public:
	BaseObject();
	virtual ~BaseObject();

	virtual void Update(float _dt);
	virtual void Render();

	void LoadMesh(const char* fileLocation);
	virtual void SetPosition(D3DXVECTOR3& pos);
	D3DXVECTOR3& GetPosition() {return m_Position;}
	void SetVelocity(D3DXVECTOR3& vel) {m_Velocity = vel;}

	void ApplyTransfomationMatrixToRenderer();

#pragma region // accessors/mutators


#pragma endregion
};

// TODO make this class renderable
class BaseObject2D : public BaseObjectBase
{
protected:
	int m_nTextureID;
	D3DXVECTOR2 m_vPosition;
	D3DXVECTOR2 m_vVelocity;
	float m_fScaleX;
	float m_fScaleY;
	float m_fRotCenterX;
	float m_fRotCenterY;
	float m_fRotation;
	RECT m_pSection;
	DWORD m_dwColor;

public:
	BaseObject2D();
	virtual ~BaseObject2D();

	virtual void Render();
	virtual void Update(float _dt);

	void SetTextureID(int ID);
	inline int GetTextureID()			{return m_nTextureID;}

	inline void SetPosition(float x, float y) {m_vPosition.x = x; m_vPosition.y = y;}
	inline void SetVelocity(float x, float y) {m_vVelocity.x = x; m_vVelocity.y = y;}
	inline void SetScale(float x, float y) {m_fScaleX = x; m_fScaleY = y;}
	inline void SetRotation(float x, float y, float rot) {m_fRotCenterX = x; m_fRotCenterY = y; m_fRotation = rot;}

	inline const D3DXVECTOR2 GetPosition() {return m_vPosition;}
	inline const D3DXVECTOR2 GetVelocity() {return m_vVelocity;}
	inline const float GetScaleX() {return m_fScaleX;}
	inline const float GetScaleY() {return m_fScaleY;}
	inline const float GetRotCenterX() {return m_fRotCenterX;}
	inline const float GetRotCenterY() {return m_fRotCenterY;}
	inline const float GetRotationX() {return m_fRotation;}

#pragma region // Acessors/Mutators

#pragma endregion
};
